package com.example.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/v1/send")
public class SendMsgController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @PostMapping("toRabbit")
    public void send(String msg){
        rabbitTemplate.convertAndSend("up_queue", msg);
    }
}